Skip to content

Add tracking of query call locations#154402

Closed
Zoxc wants to merge 5 commits intorust-lang:mainfrom
Zoxc:query-call-tracking
Closed

Add tracking of query call locations#154402
Zoxc wants to merge 5 commits intorust-lang:mainfrom
Zoxc:query-call-tracking

Conversation

@Zoxc
Copy link
Copy Markdown
Contributor

@Zoxc Zoxc commented Mar 26, 2026

This adds tracking of query call locations using #[track_caller] in additional to associating query calls with a span.

Query call locations are printed for query panic stack traces and for -Z verbose-internals. The latter being helpful to track down accidental query cycles.

@rustbot rustbot added A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 26, 2026
@rust-log-analyzer

This comment has been minimized.

@Zoxc Zoxc force-pushed the query-call-tracking branch from f641c01 to 4197e18 Compare March 26, 2026 05:53
@rust-log-analyzer

This comment has been minimized.

@Zoxc Zoxc force-pushed the query-call-tracking branch from 4197e18 to 3ac1303 Compare March 26, 2026 08:00
@Zoxc
Copy link
Copy Markdown
Contributor Author

Zoxc commented Mar 26, 2026

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Mar 26, 2026
rust-bors bot pushed a commit that referenced this pull request Mar 26, 2026
Add tracking of query call locations
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 26, 2026

☀️ Try build successful (CI)
Build commit: e18d7fc (e18d7fcbe3f871aec31f0224187f0c39cf3a264a, parent: 3ea2fbcb2a872b7e1fa3cada256f8e97f9e6636f)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (e18d7fc): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
0.4% [0.1%, 1.1%] 105
Regressions ❌
(secondary)
0.4% [0.1%, 1.6%] 121
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.4% [0.1%, 1.1%] 105

Max RSS (memory usage)

Results (secondary -1.5%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
5.2% [4.8%, 5.7%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.0% [-6.2%, -5.5%] 3
All ❌✅ (primary) - - 0

Cycles

Results (secondary 0.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.3% [4.3%, 4.3%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.6% [-2.6%, -2.6%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 485.545s -> 486.608s (0.22%)
Artifact size: 395.12 MiB -> 395.40 MiB (0.07%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Mar 26, 2026
@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Mar 29, 2026

☔ The latest upstream changes (presumably #154304) made this pull request unmergeable. Please resolve the merge conflicts.

@Zoxc
Copy link
Copy Markdown
Contributor Author

Zoxc commented Mar 30, 2026

Overhead seems a bit on the high side to have on by default.

BenchmarkBeforeAfterBeforeAfterBeforeAfter
TimeTime%Physical MemoryPhysical Memory%Committed MemoryCommitted Memory%
🟣 clap:check1.0015s1.0051s 0.36%148.86 MiB149.25 MiB 0.26%192.43 MiB192.47 MiB 0.03%
🟣 hyper:check0.1983s0.1992s 0.46%80.31 MiB80.64 MiB 0.42%123.83 MiB123.81 MiB -0.02%
🟣 regex:check0.6043s0.6073s 0.50%112.82 MiB113.23 MiB 0.36%153.90 MiB154.00 MiB 0.06%
🟣 syn:check1.0023s1.0034s 0.11%141.96 MiB142.23 MiB 0.19%180.06 MiB179.98 MiB -0.04%
Total2.8063s2.8150s 0.31%483.94 MiB485.35 MiB 0.29%650.21 MiB650.26 MiB 0.01%
Summary1.0000s1.0036s 0.36%1 byte1.00 bytes 0.31%1 byte1.00 bytes 0.01%

@Zoxc Zoxc closed this Mar 30, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) perf-regression Performance regression. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants